package com.example.demo;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

public class CustomDialog extends AlertDialog {
    private Context context;
    protected CustomDialog(Context context) {
        super(context);
//        super(context,R.style.CustomDialog);
        this.context = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        //通过LayoutInflater来获取布局文件对象
        LayoutInflater inflater = LayoutInflater.from(context);
        View customView = inflater.inflate(R.layout.custom_layout, null);
        setView(customView);
        super.onCreate(savedInstanceState);

    }
}
